package pl.puntin.punclient.messages;

public class JoinRoomMessage extends Message {

	String roomId;
	
	public JoinRoomMessage(String roomId)
	{
		this.roomId = roomId;
	}
	
	@Override
	public byte getType() {
		return MessageTypes.C_JOIN_ROOM;
	}

	@Override
	public byte[] getByteForm() {
		byte[] byteForm = new byte[roomId.length()+1];
		for (int i = 0; i < byteForm.length; i++)
		{
			if(i == 0) byteForm[i] = getType();
			else
			{
				byteForm[i] = (byte) roomId.charAt(i-1);
			}
		}
		return byteForm;
	}

}
